﻿namespace Apex.ASPNETCore.Cache
{
    public interface IRedisHelper
    {
        // 字符串操作
        Task<bool> SetStringAsync(string key, string value, TimeSpan? expiry = null);
        Task<string> GetStringAsync(string key);
        Task<bool> DeleteStringAsync(string key);

        // 哈希操作
        Task<bool> HashSetAsync(string key, string field, string value);
        Task<string> HashGetAsync(string key, string field);
        Task<long> HashDeleteAsync(string key, string[] fields);

        // 列表操作
        Task<long> ListLeftPushAsync(string key, string value);
        Task<long> ListRightPushAsync(string key, string value);
        Task<string> ListLeftPopAsync(string key);
        Task<string> ListRightPopAsync(string key);

        // 集合操作
        Task<bool> SetAddAsync(string key, string value);
        Task<bool> SetRemoveAsync(string key, string value);
        Task<bool> SetContainsAsync(string key, string value);
        Task<string[]> SetMembersAsync(string key);

        // 有序集合操作
        Task<bool> SortedSetAddAsync(string key, string member, double score);
        Task<bool> SortedSetRemoveAsync(string key, string member);
        Task<double?> SortedSetScoreAsync(string key, string member);
        Task<long?> SortedSetRankAsync(string key, string member);

        // 键操作
        Task<bool> KeyExistsAsync(string key);
        Task<long> KeyExpireAsync(string key, TimeSpan expiry);
        Task<long> KeyDeleteAsync(string key);
    }
}